﻿
using System.Windows.Controls;
namespace NavFx
{
	/// <summary>
	/// Interface for components handling transition from one dynamically loaded page to another
	/// </summary>
	public abstract class TransitorBase: ITransitor
	{

		#region Private members

		private object target = null;

		#endregion


		/// <summary>
		/// Handles tansition from the current page to the next page to be displayed
		/// </summary>
		/// <param name="previousPage">The page being moved from</param>
		/// <param name="nextPage">The page to be displayed</param>
		public abstract void TransitionPage(IPage previousPage, IPage nextPage);


		/// <summary>
		/// Target for displaying the page
		/// </summary>
		public object Target
		{
			get
			{
				return this.target;
			}

			set
			{
				if(value is Application || value is Panel || value is UserControl)
				{
					this.target = value;
				}
				else
				{
					throw (new TargetNotSupportedException("The object is not supported as a navigation target by the NavFx framework"));
				}
			}
		}
	}
}
